package com.hongsheng.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hongsheng.mapper.PackageMapper;
import com.hongsheng.pojo.Bill;
import com.hongsheng.pojo.Package;
import com.hongsheng.service.PackgeService;
import org.apache.logging.log4j.util.Strings;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;

/**
 * @description 包装service实现类,下面是用mybatisplus的自带的crud,免得重复的写crud操作
 **/
@Service
public class PackageServiceImpl extends ServiceImpl<PackageMapper, Package> implements PackgeService {
    @Override
    public IPage<Package> getPage(int currentPage, int size, Package pack) {
        //按条件查询
        LambdaQueryWrapper<Package> wrapper=new LambdaQueryWrapper<>();
        wrapper.like(Strings.isNotEmpty(pack.getType()),Package::getType,pack.getType());
        Page<Package> page=new Page<>(currentPage,size);
        Page<Package> page1 = baseMapper.selectPage(page, wrapper);
        return page1;
    }
}
